## Exercise-3-3-3-7
import numpy as np
import matplotlib.pyplot as plt

# 创建画布
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))

# 左图: 绘制单位圆 |z| = 1 和 |z| = 2
theta = np.linspace(0, 2 * np.pi, 100)
circle1 = 1/4+1/4*np.exp(1j * theta)
circle2 = np.exp(1j * theta)

ax1.plot(np.real(circle1), np.imag(circle1), label='|z-1/4|=1/4')
ax1.plot(np.real(circle2), np.imag(circle2), label='|z|=1')
ax1.set_title('Left Figure: z in the complex plane')
ax1.set_xlabel('Re(z)')
ax1.set_ylabel('Im(z)')
ax1.legend()
ax1.grid(True)
ax1.axis('equal')

# 右图: 绘制 w = myf(z)
def myf(z,R):
    return (R-R**2*z)/(z-R)

R=2+np.sqrt(3)
translated_circle1 = myf(circle1,R)
translated_circle2 = myf(circle2,R)

ax2.plot(np.real(translated_circle1), np.imag(translated_circle1), label='|w|=1')
ax2.plot(np.real(translated_circle2), np.imag(translated_circle2), label='|w|=R=2+sqrt(3)')
ax2.set_title('Right Figure: w = (R-R^2z)/(z-R)')
ax2.set_xlabel('Re(w)')
ax2.set_ylabel('Im(w)')
ax2.legend()
ax2.grid(True)
ax2.axis('equal')

plt.show()
